package com.financial.business.integral.controller;

import com.financial.business.integral.service.FinancialIntegralPayService;
import com.financial.business.integral.service.FinancialIntegralPaymentService;
import com.financial.business.integral.service.FinancialIntegralQueryService;
import com.financial.business.integral.service.FinancialIntegralRefundService;
import com.financial.business.integral.utils.apiresult.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @api {post} /business/integral
 * @apiExample
 * author WANGNING
 * tar 积分支付业务
 * date 2019年10月29日
 * @apiGroup balance-integral
 * @apiVersion 1.0.0
 * @apiHeader {String} null 无
 * @apiParam {String} null 无
 * @apiSuccess {String} succeed 就绪
 */
@RestController
@RequestMapping("/integral")
public class FinancialIntegralController {
    @Autowired
    private FinancialIntegralPayService financialIntegralPayService;

    @Autowired
    private FinancialIntegralQueryService financialIntegralQueryService;

    @Autowired
    private FinancialIntegralRefundService financialIntegralRefundService;

    @Autowired
    private FinancialIntegralPaymentService financialIntegralPaymentService;
    /**
     * 积分支付
     *
     * @param requestParam
     * @return
     */
    @RequestMapping(value = {"/pay"},method = {RequestMethod.POST})
    @ResponseBody
    public ApiResult pay(@RequestBody String requestParam) {

        return financialIntegralPayService.pay(requestParam);
    }

    /**
     * 积分退款
     *
     * @param requestParam
     * @return
     */
    @RequestMapping(value = {"/refund"}, method = {RequestMethod.POST})
    @ResponseBody
    public ApiResult refund(@RequestBody String requestParam) {

        return financialIntegralRefundService.refund(requestParam);
    }

    /**
     * 积分代付/转账
     *
     * @param requestParam
     * @return
     */
    @RequestMapping(value = {"/payment"},method = {RequestMethod.POST})
    @ResponseBody
    public ApiResult payment(@RequestBody String requestParam) {

        return financialIntegralPaymentService.payment(requestParam);
    }

    /**
     * 积分所有查询
     *
     * @param requestParam
     * @return
     */
    @RequestMapping(value = {"/query"}, method = {RequestMethod.POST})
    @ResponseBody
    public ApiResult query(@RequestBody String requestParam) {

        return financialIntegralQueryService.query(requestParam);
    }
}
